package com.example.d6_homework.homework06.entry;


import com.example.d6_homework.homework06.context.ApplicationContext;
import com.example.d6_homework.homework06.context.ClasspathApplicationContext;
import com.example.d6_homework.homework06.service.OrderService;
import com.example.d6_homework.homework06.service.UserService;

public class Entry {
    public static void main(String[] args) {
        // 创建ClasspathApplicationContext对象
        ApplicationContext applicationContext = new ClasspathApplicationContext("day24-junit-reflect-annotation-proxy/src/applicationContext.properties");

        // 从applicationContext对象获取userService对象,并进行使用
        UserService userService = applicationContext.getBean(UserService.class);
        userService.find();

        // 从applicationContext对象获取OrderService对象,并进行使用
        OrderService orderService1 = applicationContext.getBean(OrderService.class);
        orderService1.find();

        // 从applicationContext对象获取OrderService对象,比较与上面所获取的对象是否相等
        OrderService orderService2 = applicationContext.getBean(OrderService.class);
        System.out.println(orderService1 == orderService2);
    }
}
